home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20020314-20021006 / 000328_fdc@columbia.edu_Thu Aug 29 12:06:56 EDT 2002.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  105 lines

  1. Article: 13658 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
  3. From: fdc@columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.protocols.kermit.misc
  5. Subject: Re: scripting capturing of Cisco ARP tables
  6. Date: 29 Aug 2002 12:06:47 -0400
  7. Organization: Columbia University
  8. Lines: 88
  9. Message-ID: <aklgqn$2gv$1@watsol.cc.columbia.edu>
  10. References: <3d6e39ea@yorrell.saard.net>
  11. NNTP-Posting-Host: watsol.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1030637208 6787 128.59.39.139 (29 Aug 2002 16:06:48 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 29 Aug 2002 16:06:48 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13658
  16.  
  17. In article <3d6e39ea@yorrell.saard.net>,
  18. Arthur Marsh  <arthur.marsh@adelaide.edu.au> wrote:
  19. : Hi, I've been out of practice with writing Kermit scripts and want to do 
  20. : the following:
  21. : Given one series of IP addresses:
  22. Put them in an array, loop thru the array, e.g.:
  23.  
  24.   dcl \&a[] = 123.456.789.001 123.456.789.002 123.456.789.003 123.456.789.004
  25.   for \%i 1 \fdim(&a) 1 {
  26.       ...
  27.   }
  28.  
  29. Or read the addresses into the array from a file, whatever.  For more
  30. about arrays, see the book and:
  31.  
  32.   http://www.columbia.edu/kermit/ckermit70.html#x7.10
  33.  
  34. For file i/o, see:
  35.  
  36.   http://www.columbia.edu/kermit/ckermit70.html#x1.22
  37.  
  38. : telnet to each IP address in turn,
  39. set host \&a[\%i]
  40. if fail ...
  41.  
  42. : send a:
  43. : show arp
  44. : command
  45. : and send a space character as long as a "More" prompt appears
  46. : For each line that starts with "Internet", log the 4th and 2nd space 
  47. : delimited string to a file.
  48. Something like this:
  49.  
  50.   fopen /write \%c outfile
  51.   if fail ...
  52.  
  53.   lineout show arp              ; Send "show arp" and CR
  54.   set flag on                   ; Loop control
  55.   while flag {                  ; Loop
  56.       clear input               ; Clear INPUT buffer
  57.       minput 10 "\10" "More?" "Prompt>"  ; Wait for trigger strings
  58.       if fail break
  59.       switch \v(minput) {
  60.         :1, if equal "\fleft(\v(input),8)" "Internet" {
  61.             fwrite \%c \v(input)
  62.             }
  63.             break
  64.         :2, output " "
  65.             break
  66.         :3, set flag off
  67.       }
  68.   }
  69.  
  70. Here you need to get the exact syntax of the More prompt and the 
  71. Cisco shell prompt.
  72.  
  73. Maybe each Cisco box has a different shell prompt.  Then you need parallel
  74. arrays for the IP addresses and the shell prompts.  See the "mpservers"
  75. sample script in the C-Kermit / K95 Script library:
  76.  
  77.   http://www.columbia.edu/kermit/ckscripts.html
  78.  
  79. : There are a couple of variations.
  80. : One device needs to be sent the comand
  81. : session 15 <cr>
  82. : after the initial log-in and before the "show arp" command.
  83. : Some devices need
  84. : session 15 <cr>
  85. : followed by a second username/password (identical to the first)
  86. : after the initial log-in and before the "show arp" command.
  87. Use a SWITCH statement on the hostname/address.
  88.  
  89. - Frank
  90.